export const KEY_COMPONENT_NAME = 'cif-';

export const CPNT_REF_PREFIX_ENUM = {
	CPNT_DEF: 'cpnt-def-', // 定义组件类型
	CPNT_INST: 'cpnt-inst', // 定义组件实例
	CPNT_WRAPPER: 'cpnt-wrapper' // 定义组件包裹
};

export const RUNTIME_CFG_ENUM = {
	CIF_MODE: 'cif_mode',
	COMPONENT_LIBRARY: 'component_library',
	COMPONENT_LIBRARY_PARAM: 'component_library_param',
	THEME_LIBRARY: 'theme_library',
	APPLICATION_ID: 'application_id',
	APPLICATION_NAME: 'application_name',
	APPLICATION_REFRENCE_COMPONENT: 'application_refrence_component',
	APPLICATION_REFRENCE_COMPONENT_CFG: 'application_refrence_component_cfg',
	APPLICATION_COMPONENT_TREE: 'application_component_tree',
	APPLICATION_COMPONENT_TREE_CFG: 'application_component_tree_cfg',

	APPLICATION_SCENE_TREE: 'APPLICATION_SCENE_TREE',
	DEFAULT_ENGINE_TYPE: 'DEFAULT_ENGINE_TYPE',
	APPLICATION_BASEMAP: 'application_basemap',

	APPLICATION_THEME_CFG: 'application_theme_cfg',
	APPLICATION_THEME: 'application_theme',
	DYNAMIC_COPONENT_LOADER: 'dynamic_coponent_loader',
	CIF_RUNNING_MODE: 'cif_running_mode', // 本地开发模式
	DEV_MODE: 'dev_mode', // 本地开发模式，读取本地组件，可以配置，不能保存
	EDIT_MODE: 'edit_mode', // 可视化组件配置模式，可以配置，可以保存
	PREVIEW_MODE: 'preview_mode', // 组件预览模式，可以配置，不能保存
	PRODUCTION_MODE: 'production_mode', // 生产模式，仅预览，不能配置，不能保存

	CUSTOM_RENDERER_CANVAS_SIZE: 'custom_renderer_canvas_size', // 生产模式

	CONTEXT_OPTIONS: 'context_options'
};

export const POSITION_ENUM = ['height', 'width', 'left', 'top', 'right', 'bottom', 'positionType'];

export const PROPS_ENUM = {
	nodeKey: 'id',
	label: 'label',
	value: 'value',
	desc: 'desc',
	groups: 'groups',
	title: 'title',
	leaf: 'leaf',
	children: 'children',
	labelText: '名称',
	disabled: 'disabled'
};
export const HTTP_PROPS_ENUM = {
	name: 'name',
	url: 'url',
	fileName: 'file',
	res: ''
};
export const DATE_LIST_ENUM = [
	'dates',
	'date',
	'datetime',
	'datetimerange',
	'daterange',
	'time',
	'timerange',
	'week',
	'month',
	'monthrange',
	'year'
];
export const INPUT_LIST_ENUM = ['tree', 'number', 'icon', 'color', 'table', 'map'];
export const ARRAY_LIST_ENUM = ['img', 'array', 'url'];
export const MULTIPLE_LIST_ENUM = ['cascader', 'tree', 'select'];
export const RANGE_LIST_ENUM = ['slider'];
export const ARRAY_VALUE_LIST_ENUM = ARRAY_LIST_ENUM.concat([
	'upload',
	'dynamic',
	'map',
	'checkbox',
	'cascader',
	'dynamic',
	'timerange',
	'monthrange',
	'daterange',
	'datetimerange',
	'dates'
]);
export const SELECT_LIST_ENUM = DATE_LIST_ENUM.concat([
	'select',
	'checkbox',
	'radio',
	'cascader',
	'tree',
	'color',
	'icon',
	'table',
	'map'
]);
export const ENUM_SHOW_SPLITOR = ' | ';
export const ENUM_SPLITOR = ',';

export function propsPick(props, keys) {
	const result = {};
	keys.forEach((key) => {
		key in props && (result[key] = props[key]);
	});
	return result;
}
